<LINK title=win2k-1 media=all href="file/calendar-win2k-1.css" type=text/css rel=stylesheet>
<SCRIPT src="file/calendar.js" type=text/javascript></SCRIPT>  
<SCRIPT src="file/calendar-setup.js" type=text/javascript></SCRIPT>
<SCRIPT src="file/calendar-en.js" type=text/javascript></SCRIPT>

<?php
$id = 0;
$table = "banner";
$mod = $_GET['mod'];
$title_add = '"Banner"';

$listid = $_GET['listid'];
$key_str = substr($listid, 0, strlen($listid) - 1);
$key_arr = explode(',', $key_str);
$num_edit = count($key_arr);

$db = new MySQL();
?>
<script type="text/JavaScript">
    function checkinput()
    {

    return true;
    }

    function save(id)
    {
    var frm=document.frmedit;		
    if(checkinput())
    {
    if(id==0)  frm.action="?mod=<?= $mod ?>&act=process";
    else frm.action="?mod=<?= $mod ?>&act=process&id="+id;
    frm.method="POST";
    frm.submit();
    }
    }

    function resetfrom()
    {
    document.frmedit.reset();

    }

</script>

<div class="page-header">
    <div class="pull-left"><?= $title_add ?></div>
    <div class="pull-right"></div>
    <div class="clear"></div>
</div>

<form name="frmedit" method="post" enctype="multipart/form-data" onSubmit="return checkinput();" class="form-horizontal">

    <?php
    $sql = $db->select("select * from $table where id in ('" . str_replace(",", "','", $key_str) . "')");
    $i = 0;
    while ($te = $db->fetch($sql)) {
        $i++;
        ?>
        <div class="form-group">
            <label class="col-sm-3 control-label">Image (1600px*550px) : </label>
            <div class="col-sm-9">
                <input type="file" name="image_<?= $i ?>" />
                <?php
                if ($te['image'] != "" && file_exists("../banner-img/" . $te['image'])) {
                    echo '<br/><img class="img-thumbnail"  src="' . APPLICATION_URL . 'banner-img/' . $te['image'] . '" width="500px"  />';
                }
                ?>
            </div>
        </div>
        
        <?php
    }
    ?>	
    <div class="form-group">
        <div class="col-sm-offset-3 col-sm-9">
            <button type="button" class="btn btn-primary" onclick="save(<?= $id ?>);">Save</button>
            <button type="reset" class="btn btn-default">Reset</button>
        </div>
    </div>
    <input type="hidden" name="form_" value="editlist">
    <input type="hidden" name="listid" value="<?= $listid ?>" />
</form>